package cn.ssm.controller;

import cn.ssm.mapper.UserMapper;
import cn.ssm.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.annotation.WebServlet;
import java.util.List;

/**
 * @Author ruanxin
 */
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserMapper userMapper;

    @RequestMapping("/loadAll")
    public String findAllUsers(Model model) {
        List<User> allUsers = userMapper.findAllUsers();
        model.addAttribute("users", allUsers);
        return "userList";
    }
}
